package com.changgou;

import com.changgou.util.IdWorker;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
import org.springframework.stereotype.Component;
import tk.mybatis.spring.annotation.MapperScan;

@SpringBootApplication
@EnableEurekaClient
@EnableRedisHttpSession
@MapperScan(basePackages = {"com.changgou.goods.dao", "com.changgou.handler"})

public class GoodsApplication {
    public static void main(String[] args) {
        SpringApplication.run( GoodsApplication.class);
    }


    @Value("${workerId}")
    private int workerId;    //工作id

    @Value("${datacenterId}")
    private int datacenterId;   //数据中心id

    @Bean
    public IdWorker idWorker(){
        return new IdWorker(workerId, datacenterId);
    }
}
